<template>
	<view class="orderDetail">
		<view class="title">订单委托信息</view>
		<view class="card">
			<view class="row flex-j-sb">
				<text class="txt">商品代码/名称</text>
				<text>{{dataList.goodsCode}}/{{dataList.goodsName}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">方向</text>
				<text>{{dataList.direction==0?'买入':'卖出'}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">类型</text>
				<text>{{dataList.type==0?'订立':'转让'}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">委托数量</text>
				<text>{{dataList.num || 0}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">委托价格</text>
				<text>{{dataList.price || '0.00'}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">成交数量</text>
				<text>{{dataList.dealNum || 0}}</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">委托状态</text>
				<text>已成</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">委托时间</text>
				<text>2023-12-24 12:00:50</text>
			</view>
			<view class="row flex-j-sb">
				<text class="txt">委托单号</text>
				<text>{{dataList.orderId}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import { getUserOrder } from '@/api/home.js'
	export default {
		data() {
			return {
				dataList:{},
				transfer:false,
				submitVal:'', // 交收信息
				id:'',
			};
		},
		onLoad(e) {
			if(e.id){
				this.id = e.id
			}
			this.getData()
		},
		methods:{
			async getData(){ //
				const res = await getUserOrder()
				if(res.rows) {
					let arr = res.rows.filter(item => item.orderId == this.id)
					this.dataList = arr[0]
				}
			},
			submit(i) { // 1为转让 ，2为提交
				uni.showModal({
					content:`确定要${i===1?'转让':'提交'}吗`,
					complete: (result) => {
						if(result.confirm){
							console.log(2222);
						}
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	::v-deep {
		.uicon-minus {
			background-color: white !important;
			border: 1rpx solid #1989FA !important;
			color: #1989FA !important;
		}
	}
.orderDetail {
	padding: 20rpx;
	font-size: 28rpx;
	.title {
		color: gray;
		margin-bottom: 20rpx;
	}
	.card {
		padding: 0px 20rpx;
		margin-bottom: 20rpx;
		background-color: white;
		border-radius: 5px;
		.row {
			padding: 20rpx 0px;
			color: gray;
			text-align: right;
			+.row {
				border-top: 1rpx solid #eee;
			}
			.txt {
				flex-shrink: 0;
				margin-right: 20rpx;
				color: black;
			}
			.ipt {
				flex: 1;
			}
			.red {
				color: #E20000;
			}
		}
	}
}

.btn {
	width: 90%;
	padding: 20rpx 0px;
	margin: 60rpx auto 0px;
	border-radius: 5px;
	background-color: #C30D23;
	color: white;
	text-align: center;
}
</style>
